#include "StdAfx.h"
#include "XML_Handler.h"
#include <string>


XML_Handler::XML_Handler(void)
{
}

System::Xml::XmlDocument^ XML_Handler::create_login( System::String^ user, System::String^ pass )
{
	XmlDocument^ doc = gcnew XmlDocument();
	XmlDeclaration^ xd = doc->CreateXmlDeclaration("1.0", "utf-8", nullptr);
	XmlElement^ root = doc->CreateElement("Artemis");
	XmlElement^ query_node = doc->CreateElement("query");
	XmlElement^ type_node = doc->CreateElement("type");
	XmlElement^ data_node = doc->CreateElement("data");
	doc->InsertBefore(xd, doc->DocumentElement);
	doc->AppendChild(root);
	root->AppendChild(query_node);
	query_node->AppendChild(type_node);
	query_node->AppendChild(data_node);
	XmlText^ type_text = doc->CreateTextNode("DIRECT");
	XmlText^ data_text = doc->CreateTextNode("SELECT FROM Users_Table WHERE Username=" + user + " & WHERE Password=" + pass);
	type_node->AppendChild(type_text);
	data_node->AppendChild(data_text);
	return doc;
}